<?php require_once('../connections/con_gl.php');  ?>
<?php
$act = $_GET[act];
$url = "index.php?component=dstatus";

/* Validasi */
if (trim($_POST['status_nama']) == '') {
	$error[] = '- Nama Status harus diisi';
}

/*End validasi */
if (isset($error)) {
	echo "<b>Error</b>: <br />".implode("<br />", $error);
}else{
	if($act =='add') {
		$query = "INSERT INTO dcm_ref_status_dokumen (status_no, status_nama, deskripsi) VALUES ('$_POST[status_no]','$_POST[status_nama]', '$_POST[deskripsi]')";
	}else if($act=='edit'){
		$query ="UPDATE dcm_ref_status_dokumen SET status_nama='$_POST[status_nama]', deskripsi='$_POST[deskripsi]' WHERE status_id='$_POST[status_id]'";
	}else{
		$query = "delete from dcm_ref_status_dokumen where status_nama='$_POST[status_nama]'";
	}
	mysql_select_db($database_con_gl, $con_gl);
	$runquery = mysql_query($query, $con_gl);
	if($runquery) {
		echo "<img src=\"images/ok.png\" align=\"left\" width=\"16\">&nbsp;&nbsp;Data berhasil ";if($act=='add' OR $act=='edit') { echo "disimpan";}else{ echo "dihapus"; } echo " ...";
	}else{
		echo "<img src=\"images/alert.png\" align=\"left\" width=\"16\"> Data gagal disimpan !!!";
	}
}
?>
<?php if($runquery) { ?><script type="text/javascript">setTimeout("location.href='<?php echo $url;?>'", 2000);</script><?php } ?>